Question: Are delays independent to time of day, or day of week?

Outline of this Python Notebook:

  1. Data Exploration
  2. Premodeling (Feature Engineering)
  3. Time Series Analysis

Data Exploration¶

In [ ]:
 

Data Importing & Preprocessing¶

In [1]:
# import necessarry Python libraries
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import datetime

import matplotlib.pyplot as plt
import matplotlib
from matplotlib.pyplot import figure
import plotly.express as px
In [2]:
matplotlib.rcParams['figure.figsize'] = [10, 10]
In [3]:
# import data
# Data from 2022 only
data2022 = pd.read_excel('SE - Terminal Wait Times - TimeSeries.xlsx', sheet_name='2022').copy()
In [4]:
data2022.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 29809 entries, 0 to 29808
Data columns (total 6 columns):
 #   Column            Non-Null Count  Dtype         
---  ------            --------------  -----         
 0   Transponder       29809 non-null  int64         
 1   LocationIn        29809 non-null  object        
 2   LocationOut       29809 non-null  object        
 3   TimeIn            29809 non-null  datetime64[ns]
 4   TimeOut           29809 non-null  datetime64[ns]
 5   Difference (min)  29809 non-null  int64         
dtypes: datetime64[ns](2), int64(2), object(2)
memory usage: 1.4+ MB
In [5]:
# Convert datetime to date
data2022['Date'] = pd.to_datetime(data2022['TimeIn']).dt.date 

# Create DAY column
days = ['Mon','Tues','Wed','Thurs','Fri','Sat','Sun']
weekday = []
for i in data2022['Date']:
    weekday.append(days[i.weekday()])
   # print(i)
data2022['Weekday'] = weekday

# Create MONTH column
data2022['Month'] = [i.strftime("%B") for i in data2022['Date']]

# Rename column to "Delay"
data2022.rename(columns = {'Difference (min)':'Delay'}, inplace = True)
In [6]:
# Create HOUR column
hours = ['07:00-07:59','08:00-08:59','09:00-09:59','10:00-10:59','11:00-11:59','12:00-12:59','13:00-13:59', 
        '14:00-14:59', '15:00-15:59', '16:00-16:59', '17:00-17:59', '18:00-18:59', '19:00-20:00']
Hours = []
for i in data2022['TimeIn']:
    if (i.time() > datetime.time(7, 0, 0) and i.time() < datetime.time(8, 0, 0) ):
        Hours.append('07:00-07:59') 
    elif(i.time() >= datetime.time(8, 0, 0) and i.time() < datetime.time(9, 0, 0) ):
        Hours.append('08:00-08:59')
    elif(i.time() >= datetime.time(9, 0, 0) and i.time() < datetime.time(10, 0, 0) ):
        Hours.append('09:00-09:59')
    elif(i.time() >= datetime.time(10, 0, 0) and i.time() < datetime.time(11, 0, 0) ):
        Hours.append('10:00-10:59')
    elif(i.time() >= datetime.time(11, 0, 0) and i.time() < datetime.time(12, 0, 0) ):
        Hours.append('11:00-11:59')
    elif(i.time() >= datetime.time(12, 0, 0) and i.time() < datetime.time(13, 0, 0) ):
        Hours.append('12:00-12:59')
    elif(i.time() >= datetime.time(13, 0, 0) and i.time() < datetime.time(14, 0, 0) ):
        Hours.append('13:00-13:59')
    elif(i.time() >= datetime.time(14, 0, 0) and i.time() < datetime.time(15, 0, 0) ):
        Hours.append('14:00-14:59')
    elif(i.time() >= datetime.time(15, 0, 0) and i.time() < datetime.time(16, 0, 0) ):
        Hours.append('15:00-15:59')
    elif(i.time() >= datetime.time(16, 0, 0) and i.time() < datetime.time(17, 0, 0) ):
        Hours.append('16:00-16:59')
    elif(i.time() >= datetime.time(17, 0, 0) and i.time() < datetime.time(18, 0, 0) ):
        Hours.append('17:00-17:59')
    elif(i.time() >= datetime.time(18, 0, 0) and i.time() < datetime.time(19, 0, 0) ):
        Hours.append('18:00-18:59')
    else:
        Hours.append('19:00-20:00')
data2022['Hours'] = Hours


"""
timeofday = ['Morning','Afternoon','Evening']
TimeOfDayColumn = []
for i in data2022['TimeIn']:
    if (i.time() > datetime.time(7, 0, 0) and i.time() < datetime.time(12, 0, 0) ):
        TimeOfDayColumn.append('Morning') #imeofday[i.TimeOfDayColumn()])
    elif(i.time() >= datetime.time(12, 0, 0) and i.time() < datetime.time(14, 0, 0) ):
        TimeOfDayColumn.append('Afternoon')
    else:
        TimeOfDayColumn.append('Evening')
data2022['Time Of Day'] = TimeOfDayColumn
"""
Out[6]:
"\ntimeofday = ['Morning','Afternoon','Evening']\nTimeOfDayColumn = []\nfor i in data2022['TimeIn']:\n    if (i.time() > datetime.time(7, 0, 0) and i.time() < datetime.time(12, 0, 0) ):\n        TimeOfDayColumn.append('Morning') #imeofday[i.TimeOfDayColumn()])\n    elif(i.time() >= datetime.time(12, 0, 0) and i.time() < datetime.time(14, 0, 0) ):\n        TimeOfDayColumn.append('Afternoon')\n    else:\n        TimeOfDayColumn.append('Evening')\ndata2022['Time Of Day'] = TimeOfDayColumn\n"
In [7]:
data2022
Out[7]:
Transponder LocationIn LocationOut TimeIn TimeOut Delay Date Weekday Month Hours
0 8230 2(A) 2(En) 2022-01-03 10:18:52 2022-01-03 11:05:40 6 2022-01-03 Mon January 10:00-10:59
1 11839 2(A) 2(En) 2022-01-03 10:52:33 2022-01-03 11:06:57 7 2022-01-03 Mon January 10:00-10:59
2 8160 2(A) 2(En) 2022-01-03 10:45:37 2022-01-03 11:08:21 8 2022-01-03 Mon January 10:00-10:59
3 11391 2(A) 2(En) 2022-01-03 11:17:15 2022-01-03 11:18:41 1 2022-01-03 Mon January 11:00-11:59
4 43698 2(A) 2(En) 2022-01-03 11:12:13 2022-01-03 11:19:00 7 2022-01-03 Mon January 11:00-11:59
... ... ... ... ... ... ... ... ... ... ...
29804 58660 2(En) 2(Ex) 2022-03-31 19:12:26 2022-03-31 19:36:49 24 2022-03-31 Thurs March 19:00-20:00
29805 58660 2(A) 2(Ex) 2022-03-31 19:03:53 2022-03-31 19:36:49 33 2022-03-31 Thurs March 19:00-20:00
29806 8160 2(A) 2(Ex) 2022-03-31 19:08:27 2022-03-31 19:38:26 30 2022-03-31 Thurs March 19:00-20:00
29807 8456 2(En) 2(Ex) 2022-03-31 19:27:31 2022-03-31 19:43:26 16 2022-03-31 Thurs March 19:00-20:00
29808 8456 2(A) 2(Ex) 2022-03-31 19:20:51 2022-03-31 19:43:26 23 2022-03-31 Thurs March 19:00-20:00

29809 rows × 10 columns

In [8]:
display(data2022.groupby(['Weekday']).sum())

display(data2022.groupby(['Weekday']).mean())
Transponder Delay
Weekday
Fri 139180103 353829
Mon 114137243 255259
Sat 4815103 5305
Thurs 137599944 298612
Tues 145193457 317407
Wed 141794727 295817
Transponder Delay
Weekday
Fri 23514.124514 59.778510
Mon 22596.959612 50.536329
Sat 24442.147208 26.928934
Thurs 22743.792397 49.357355
Tues 23039.266423 50.366074
Wed 22542.881876 47.029730
In [9]:
display(data2022.groupby(['Hours']).sum())

#display(data2022.groupby(['Hours']).mean())
Transponder Delay
Hours
07:00-07:59 223236 485
08:00-08:59 524829 1464
09:00-09:59 3505313 11976
10:00-10:59 20609145 63573
11:00-11:59 51807291 139002
12:00-12:59 79048383 154534
13:00-13:59 81869597 156230
14:00-14:59 84149067 183203
15:00-15:59 68010210 206859
16:00-16:59 55406054 164752
17:00-17:59 79659658 166206
18:00-18:59 75695946 133356
19:00-20:00 82211848 144589

Trend of DELAY for days of week¶

In [ ]:
 
In [10]:
data2022
Out[10]:
Transponder LocationIn LocationOut TimeIn TimeOut Delay Date Weekday Month Hours
0 8230 2(A) 2(En) 2022-01-03 10:18:52 2022-01-03 11:05:40 6 2022-01-03 Mon January 10:00-10:59
1 11839 2(A) 2(En) 2022-01-03 10:52:33 2022-01-03 11:06:57 7 2022-01-03 Mon January 10:00-10:59
2 8160 2(A) 2(En) 2022-01-03 10:45:37 2022-01-03 11:08:21 8 2022-01-03 Mon January 10:00-10:59
3 11391 2(A) 2(En) 2022-01-03 11:17:15 2022-01-03 11:18:41 1 2022-01-03 Mon January 11:00-11:59
4 43698 2(A) 2(En) 2022-01-03 11:12:13 2022-01-03 11:19:00 7 2022-01-03 Mon January 11:00-11:59
... ... ... ... ... ... ... ... ... ... ...
29804 58660 2(En) 2(Ex) 2022-03-31 19:12:26 2022-03-31 19:36:49 24 2022-03-31 Thurs March 19:00-20:00
29805 58660 2(A) 2(Ex) 2022-03-31 19:03:53 2022-03-31 19:36:49 33 2022-03-31 Thurs March 19:00-20:00
29806 8160 2(A) 2(Ex) 2022-03-31 19:08:27 2022-03-31 19:38:26 30 2022-03-31 Thurs March 19:00-20:00
29807 8456 2(En) 2(Ex) 2022-03-31 19:27:31 2022-03-31 19:43:26 16 2022-03-31 Thurs March 19:00-20:00
29808 8456 2(A) 2(Ex) 2022-03-31 19:20:51 2022-03-31 19:43:26 23 2022-03-31 Thurs March 19:00-20:00

29809 rows × 10 columns

In [11]:
data2022_groupbyDate = data2022.groupby(['Date','Month','Weekday']).sum().reset_index()
data2022_groupbyDate
# this Delay is delay of all truck in certain date 
Out[11]:
Date Month Weekday Transponder Delay
0 2022-01-03 January Mon 4093748 7452
1 2022-01-04 January Tues 8680465 21122
2 2022-01-05 January Wed 9488552 17297
3 2022-01-06 January Thurs 11402097 21555
4 2022-01-07 January Fri 8701325 26096
... ... ... ... ... ...
59 2022-03-25 March Fri 14581172 32413
60 2022-03-28 March Mon 12598617 18573
61 2022-03-29 March Tues 10960035 20530
62 2022-03-30 March Wed 10496428 18014
63 2022-03-31 March Thurs 11233831 20247

64 rows × 5 columns

In [12]:
fig = px.line(data2022_groupbyDate, x='Date', y= 'Delay', labels={'Delay': 'Delay (in minutes)'})
fig2 = px.scatter(x=['2022-01-24', '2022-02-19'], y=[48905, 5305],
                 size=[120,100])
fig.add_trace(fig2.data[0])
fig.show()

The above Line graph tells us that there are lots of delay. But, does not tell us which days have more delays!

In [46]:
fig = px.line(data2022_groupbyDate, x='Date', y= 'Delay', color='Weekday' ,
              labels={'Delay': 'Delay (in minutes)'})
fig.show()
fig.write_image("Figures/LineplotWeekday.png")

No day is significantly better than the other!

In [ ]:
 

Trend of DELAY for time of day¶

Lets split days into Morning, Afternoon & Evening

In [32]:
data2022
Out[32]:
Transponder LocationIn LocationOut TimeIn TimeOut Delay Date Weekday Month Hours Time Of Day
0 8230 2(A) 2(En) 2022-01-03 10:18:52 2022-01-03 11:05:40 6 2022-01-03 Mon January 10:00-10:59 Morning
1 11839 2(A) 2(En) 2022-01-03 10:52:33 2022-01-03 11:06:57 7 2022-01-03 Mon January 10:00-10:59 Morning
2 8160 2(A) 2(En) 2022-01-03 10:45:37 2022-01-03 11:08:21 8 2022-01-03 Mon January 10:00-10:59 Morning
3 11391 2(A) 2(En) 2022-01-03 11:17:15 2022-01-03 11:18:41 1 2022-01-03 Mon January 11:00-11:59 Morning
4 43698 2(A) 2(En) 2022-01-03 11:12:13 2022-01-03 11:19:00 7 2022-01-03 Mon January 11:00-11:59 Morning
... ... ... ... ... ... ... ... ... ... ... ...
29804 58660 2(En) 2(Ex) 2022-03-31 19:12:26 2022-03-31 19:36:49 24 2022-03-31 Thurs March 19:00-20:00 Evening
29805 58660 2(A) 2(Ex) 2022-03-31 19:03:53 2022-03-31 19:36:49 33 2022-03-31 Thurs March 19:00-20:00 Evening
29806 8160 2(A) 2(Ex) 2022-03-31 19:08:27 2022-03-31 19:38:26 30 2022-03-31 Thurs March 19:00-20:00 Evening
29807 8456 2(En) 2(Ex) 2022-03-31 19:27:31 2022-03-31 19:43:26 16 2022-03-31 Thurs March 19:00-20:00 Evening
29808 8456 2(A) 2(Ex) 2022-03-31 19:20:51 2022-03-31 19:43:26 23 2022-03-31 Thurs March 19:00-20:00 Evening

29809 rows × 11 columns

In [15]:
# hour category
In [ ]:
 
In [16]:
timeofday = ['Morning','Afternoon','Evening']
TimeOfDayColumn = []
for i in data2022['TimeIn']:
    if (i.time() > datetime.time(7, 0, 0) and i.time() < datetime.time(12, 0, 0) ):
        TimeOfDayColumn.append('Morning') #imeofday[i.TimeOfDayColumn()])
    elif(i.time() >= datetime.time(12, 0, 0) and i.time() < datetime.time(14, 0, 0) ):
        TimeOfDayColumn.append('Afternoon')
    else:
        TimeOfDayColumn.append('Evening')
data2022['Time Of Day'] = TimeOfDayColumn

"""
days = ['Morning','Afternoon','Evening']
weekday = []
for i in data2022['Date']:
    weekday.append(days[i.weekday()])
data2022['Weekday'] = weekday
"""
Out[16]:
"\ndays = ['Morning','Afternoon','Evening']\nweekday = []\nfor i in data2022['Date']:\n    weekday.append(days[i.weekday()])\ndata2022['Weekday'] = weekday\n"
In [17]:
data2022_groupbyDate = data2022.groupby(['Date','Month','Weekday']).sum().reset_index()
data2022_groupbyDate
# this Delay is delay of all truck in certain date 
Out[17]:
Date Month Weekday Transponder Delay
0 2022-01-03 January Mon 4093748 7452
1 2022-01-04 January Tues 8680465 21122
2 2022-01-05 January Wed 9488552 17297
3 2022-01-06 January Thurs 11402097 21555
4 2022-01-07 January Fri 8701325 26096
... ... ... ... ... ...
59 2022-03-25 March Fri 14581172 32413
60 2022-03-28 March Mon 12598617 18573
61 2022-03-29 March Tues 10960035 20530
62 2022-03-30 March Wed 10496428 18014
63 2022-03-31 March Thurs 11233831 20247

64 rows × 5 columns

In [18]:
data2022_groupbyTimeofDay = data2022.groupby(['Date','Month','Time Of Day']).sum().reset_index()
data2022_groupbyTimeofDay
# this Delay is delay of all truck in certain date 
Out[18]:
Date Month Time Of Day Transponder Delay
0 2022-01-03 January Afternoon 981406 1504
1 2022-01-03 January Evening 2718165 4375
2 2022-01-03 January Morning 394177 1573
3 2022-01-04 January Afternoon 2194041 2665
4 2022-01-04 January Evening 5933425 16831
... ... ... ... ... ...
185 2022-03-30 March Evening 6002447 11245
186 2022-03-30 March Morning 2429657 4225
187 2022-03-31 March Afternoon 3424136 5057
188 2022-03-31 March Evening 5946532 11675
189 2022-03-31 March Morning 1863163 3515

190 rows × 5 columns

In [19]:
data2022_groupbyHours = data2022.groupby(['Date','Month','Hours']).sum().reset_index()
data2022_groupbyHours
# this Delay is delay of all truck in certain date 
Out[19]:
Date Month Hours Transponder Delay
0 2022-01-03 January 07:00-07:59 77594 201
1 2022-01-03 January 10:00-10:59 56458 374
2 2022-01-03 January 11:00-11:59 260125 998
3 2022-01-03 January 12:00-12:59 604280 863
4 2022-01-03 January 13:00-13:59 377126 641
... ... ... ... ... ...
659 2022-03-31 March 15:00-15:59 513658 2219
660 2022-03-31 March 16:00-16:59 1188998 2020
661 2022-03-31 March 17:00-17:59 1007914 1657
662 2022-03-31 March 18:00-18:59 1210043 1801
663 2022-03-31 March 19:00-20:00 348147 237

664 rows × 5 columns

In [20]:
fig = px.scatter(data2022, x='Date', y= 'Delay', color='Time Of Day' ,
              labels={'Delay': 'Delay (in minutes)'})
fig.show()
In [21]:
fig = px.scatter(data2022_groupbyTimeofDay, x='Date', y= 'Delay', color='Time Of Day' ,
              labels={'Delay': 'Delay (in minutes)'})
fig.show()
In [43]:
fig = px.line(data2022_groupbyTimeofDay, x='Date', y= 'Delay', color='Time Of Day' ,
              labels={'Delay': 'Delay (in minutes)'}, line_dash='Time Of Day')
fig.show()
fig.write_image("Figures/LineplotTimeofDay.png")

In recent weeks, we have more delays in the evening. So, we should reschudle our evening trucks on other time (maybe extending current opening hour of terminal gates, which is 16:30 as per last week). After all, leaving of trucks during high-peak office hour & pedestrian walk in this summer time is NOT impressive.

In [ ]:
 

Bubble Plot¶

In [23]:
data2022_groupbyTimeofDayBubblePlot = data2022.groupby(['Date','Month','Time Of Day', 'Weekday', 'LocationIn']).sum().reset_index()
data2022_groupbyTimeofDayBubblePlot
Out[23]:
Date Month Time Of Day Weekday LocationIn Transponder Delay
0 2022-01-03 January Afternoon Mon 2(A) 645188 863
1 2022-01-03 January Afternoon Mon 2(En) 336218 641
2 2022-01-03 January Evening Mon 2(A) 1761331 2671
3 2022-01-03 January Evening Mon 2(En) 956834 1704
4 2022-01-03 January Morning Mon 2(A) 302555 1027
... ... ... ... ... ... ... ...
374 2022-03-31 March Afternoon Thurs 2(En) 1137864 1977
375 2022-03-31 March Evening Thurs 2(A) 3817491 7902
376 2022-03-31 March Evening Thurs 2(En) 2129041 3773
377 2022-03-31 March Morning Thurs 2(A) 1092374 1760
378 2022-03-31 March Morning Thurs 2(En) 770789 1755

379 rows × 7 columns

In [24]:
data2022_groupbyTimeofDayBubblePlot.columns
Out[24]:
Index(['Date', 'Month', 'Time Of Day', 'Weekday', 'LocationIn', 'Transponder',
       'Delay'],
      dtype='object')
In [25]:
data2022_groupbyTimeofDayBubblePlot.Transponder.unique()
data2022_groupbyTimeofDayBubblePlot.nunique()
Out[25]:
Date            64
Month            3
Time Of Day      3
Weekday          6
LocationIn       2
Transponder    379
Delay          373
dtype: int64
In [26]:
figure(figsize=(8, 6), dpi=300)
fig = px.scatter(data2022_groupbyTimeofDayBubblePlot, x="Date", y="Time Of Day", animation_frame="Month", # animation_group="LocationIn",hover_name="LocationIn" ,
           size="Delay", color="Weekday",
           size_max=55) # , range_x=[     100,100000], range_y=[25,90], 

fig["layout"].pop("updatemenus") # optional, drop animation buttons
fig.show()
fig.write_image("Figures/BubbleplotTimeofDay.png")
<Figure size 2400x1800 with 0 Axes>
In [29]:
fig = px.scatter(data2022_groupbyHours, x='Date', y= 'Delay', color='Time Of Day' , #range_color= [5,8],
              labels={'Delay': 'Delay (in minutes)'})
fig.show()
fig.write_image("Figures/scatterplotTimeofDay.png")

Delay is not dependent on day of week (linegraph), but depends on time of day, more in afternoon.

Now one can argue how I categohour into time of day? Show hourly delay for same dataset.. is the trend similar? Lets find out in the "Trend of Delay by Hours" section

Trend of DELAY by Hours¶

In [27]:
data2022_groupbyHours = data2022.groupby(['Date','Month','Time Of Day', 'Weekday', 'LocationIn', 'Hours']).sum().reset_index()
data2022_groupbyHours
Out[27]:
Date Month Time Of Day Weekday LocationIn Hours Transponder Delay
0 2022-01-03 January Afternoon Mon 2(A) 12:00-12:59 418934 526
1 2022-01-03 January Afternoon Mon 2(A) 13:00-13:59 226254 337
2 2022-01-03 January Afternoon Mon 2(En) 12:00-12:59 185346 337
3 2022-01-03 January Afternoon Mon 2(En) 13:00-13:59 150872 304
4 2022-01-03 January Evening Mon 2(A) 14:00-14:59 491364 458
... ... ... ... ... ... ... ... ...
1247 2022-03-31 March Morning Thurs 2(A) 10:00-10:59 453766 542
1248 2022-03-31 March Morning Thurs 2(A) 11:00-11:59 441820 628
1249 2022-03-31 March Morning Thurs 2(En) 09:00-09:59 67982 258
1250 2022-03-31 March Morning Thurs 2(En) 10:00-10:59 270391 881
1251 2022-03-31 March Morning Thurs 2(En) 11:00-11:59 432416 616

1252 rows × 8 columns

In [45]:
fig = px.line(data2022_groupbyHours, x='Date', y= 'Delay', color='Time Of Day' , #range_color= [5,8],
              labels={'Delay': 'Delay (in minutes)'}, line_dash='Hours')
fig.show()
fig.write_image("Figures/LineJanMar.png")
In [ ]:
 
In [30]:
fig = px.scatter(data2022_groupbyHours, x='Date', y= 'Delay', color='Hours' , #range_color= [5,8],
              labels={'Delay': 'Delay (in minutes)'}) #, legend={'traceorder':'normal'}
fig.show() 
# ++ change color pallete & transparency alpha 
In [31]:
figure(figsize=(8, 6), dpi=300)
fig = px.scatter(data2022_groupbyHours, x="Date", y="Hours", animation_frame="Month",  # animation_group="LocationIn",hover_name="LocationIn" ,
           size="Delay", color="Hours",
           size_max=55) # , range_x=[     100,100000], range_y=[25,90], 

fig["layout"].pop("updatemenus") # optional, drop animation buttons
fig.show()
<Figure size 2400x1800 with 0 Axes>
In [41]:
#fig=plt.figure(figsize=(12,12), dpi= 100, facecolor='w', edgecolor='k')
fig = px.scatter(data2022_groupbyHours, x="Date", y="Hours", animation_frame="Month",  # animation_group="LocationIn",hover_name="LocationIn" ,
           size="Delay", color="Hours",
           size_max=55) # , range_x=[     100,100000], range_y=[25,90], 

fig["layout"].pop("updatemenus") # optional, drop animation buttons

fig.update_yaxes(categoryorder="category ascending")
#plt.savefig('bubbleplotHourly.png', dpi=600)
fig.show()

fig.write_image("Figures/BubbleplotHour.png")
In [40]:
#fig=plt.figure(figsize=(12,12), dpi= 100, facecolor='w', edgecolor='k')
fig = px.scatter(data2022_groupbyHours, x="Date", y="Hours", animation_frame="Month",  # animation_group="LocationIn",hover_name="LocationIn" ,
           color="Delay"
           ) # , range_x=[     100,100000], range_y=[25,90], 

fig["layout"].pop("updatemenus") # optional, drop animation buttons

fig.update_yaxes(categoryorder="category ascending")
#plt.savefig('bubbleplotHourly.png', dpi=600)
fig.show()

fig.write_image("Figures/scatterplotHour.png")
In [34]:
#pip install -U kaleido

Exploring delay of certain truck using certain gate¶

In [33]:
# Lets read data for Transponder 8156 & LocationIn = 2(En)
data = pd.read_excel('SE - Terminal Wait Times - TimeSeries.xlsx', sheet_name='TimeSeries').copy()

data.info()

data['Date'] = pd.to_datetime(data['Date'])

data['Date'] = pd.to_datetime(data['Date']).dt.date 
display(data.head(10))

fig = px.line(data, x='Date', y= 'Delay')
fig.show() 
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 569 entries, 0 to 568
Data columns (total 2 columns):
 #   Column  Non-Null Count  Dtype         
---  ------  --------------  -----         
 0   Date    569 non-null    datetime64[ns]
 1   Delay   569 non-null    int64         
dtypes: datetime64[ns](1), int64(1)
memory usage: 9.0 KB
Date Delay
0 2020-04-28 25
1 2020-04-28 38
2 2020-05-01 33
3 2020-05-04 42
4 2020-05-05 212
5 2020-05-07 214
6 2020-05-11 12
7 2020-05-11 61
8 2020-05-12 16
9 2020-05-15 17

Transponder 8156 & LocationIn = 2(En)

In [39]:
pip install -U kaleido
Requirement already satisfied: kaleido in c:\users\tanmo\.conda\envs\port_optimizer\lib\site-packages (0.2.1)Note: you may need to restart the kernel to use updated packages.

Remarks¶

In [ ]:
n  
In [ ]:
 
In [ ]: